package com.neuedu.shop.controller;


import com.neuedu.shop.entity.User;
import com.neuedu.shop.service.UserService;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author X.Y鑫
 * @since 2021-04-12
 */
@Controller
@RequestMapping("/user")
public class UserController {
    @Resource
    private UserService userService;
    @RequestMapping(value = "/users",method = RequestMethod.GET)
    public String selectAll(ModelMap map){
        map.addAttribute("users",userService.selectList(null));
        return "forward:users.jsp";
    }
    @RequestMapping("/updateUserStatus")
    public String updateUserStatus(Integer id){
        userService.updateUserStatus(userService.selectById(id));
        return "redirect:users";
    }
}

